package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * author:z
 * time:2021/12/28 22:37
 * description:
 */
@FeignClient(name = "sms-platform-cache2107")
public interface CacheFeign {

    @RequestMapping(value = "/cache/hmget/{key}", method = RequestMethod.GET)
    public Map hMGet(@PathVariable("key") String key);

    @RequestMapping(value = "/cache/get/{key}", method = RequestMethod.GET)
    public String get(@PathVariable("key") String key);

    @PostMapping("/cache/hincr")
    public Long hincr(@RequestParam(value = "key")String key,@RequestParam(value = "field")String field,@RequestParam(value = "delta")Long delta);

    @GetMapping(value = "/cache/keys/{key}")
    public Set<String> keys(@PathVariable(value = "key")String key);

    @RequestMapping(value = "/cache/zrangebyscore/{key}")
    public Set<Object> zRangeByScore(@PathVariable(value = "key") String key, @RequestParam("min") Long min, @RequestParam(value = "max") Long max);

    @PostMapping("/cache/save2cache-object")
    public boolean save(@RequestParam String key,@RequestParam Object value);


    @RequestMapping(value = "/cache/save2cache", method = RequestMethod.POST)
    public boolean set(@RequestParam("key") String key, @RequestParam("value") String value, @RequestParam("expireSecond") Long expireSecond);

    }
